import os


basedir = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))


class Config(object):
    FLASK_WEB_NAME = '后台管理'
    SECRET_KEY = os.environ.get('SECRET_KEY') or '!@#$%^&*12345678'
    SQLALCHEMY_TRACK_MODIFICATIONS = False

    POST_PRE_PAGE = 4

    # 这里阿里云参数OSS在.env里面去配置
    OSS_BUCKET_URL = os.environ.get('OSS_BUCKET_URL')
    OSS_ACCESS_KEY_ID = os.environ.get('OSS_ACCESS_KEY_ID')
    OSS_ACCESS_KEY_SECRET = os.environ.get('OSS_ACCESS_KEY_SECRET')
    OSS_END_POINT = os.environ.get('OSS_END_POINT')
    OSS_BUCKET = os.environ.get('OSS_BUCKET')

    # ckeditor编辑器的配置
    CKEDITOR_SERVE_LOCAL = True
    CKEDITOR_ENABLE_CSRF = True
    CKEDITOR_ENABLE_CODESNIPPET = True
    CKEDITOR_FILE_UPLOADER = 'article.upload_image'
    CKEDITOR_HEIGHT = 400



class DevelopmentConfig(Config):
    SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL')


class ProductionConfig(Config):
    SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL')


config = {
    'development': DevelopmentConfig,
    'production': ProductionConfig,
}
